<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>事业合伙人</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<!-- <meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black"> -->
		<link rel="stylesheet" href="/Public/bs/css/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="/Public/css/mui.min.css" />
		<!-- <link rel="stylesheet" href="/Public/css/app.css" /> -->
		<script src="/Public/js/jquery.min.js"></script>
		<script src="/Public/layer/layer.js"></script>
		<style>
			html,body {
				background-color: #efeff4;
			}
			.title{
				margin: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
			}
			.userInfo {
				background-color: coral;
				background: url(/Public/images/4a.jpg) no-repeat center;background-size: 130% 100%;
				height: 200px;
				width: 100%;
			}
			.userImage {
				margin-top: 10px;
				margin-left: 10px;
				border: 0.1rem solid #fff;
				width: 50px;
				height: 50px;
				border-radius: 30px;
			}
			.appName{
				height: 70px;
				line-height: 70px;
				position: absolute;
				margin-left: 10px;
				font-size: 18px;
				color: white;
			}
			.logout{
				height: 30px;
				line-height: 30px;
				background: #95312f;
				position: absolute;
				right: 20px;
				width: 6.5rem;
				text-align: center;
				border-radius:15px;
				top: 18px;
				font-size: 0.9rem;
			}
			.num{
				width: 100%; 
				height: 30px; 
				font-weight: 500;
				font-size: 40px; 
				text-align: center; 
				display: block;
				color: yellow;
			}
			.jieshao{
				width: 100%; 
				height: 30px; 
				font-weight: 200;
				font-size: 17px; 
				text-align: center; 
				display: block;
				color: #fbfeff;
			}
			.icon{
				margin-top: 10px;
				margin-left: 10px;
				width: 30px;
				height: 30px;
			}
			.mui-navigate-right{
				display: block;
			
			}
			.money{
				text-align: center;
			}
			.mui-popover {
				height: 300px;
				padding-top: 6rem;
			}
			
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" style="background:#1d1c22;">
		    <a id="back" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"  href="javascript:history.back();" style="color: white;"></a>
		    <h1 class="mui-title" style="color: white; font-weight: bold;">个人中心</h1>
		</header>
		<div class="mui-content">
			<div class="userInfo" style="margin-top: 5px; clear:both; width: 100%; position: relative;">
				<img src="/Public/images/hua.png" style="position: absolute; width: 5.3rem; height: 8.5rem; z-index: 1; left:-5px;bottom: 0;filter:alpha(opacity=70);opacity: 0.7;">
				<!-- <input type="file" accept="image/*;capture=camera">  -->
				<input type="file" id="take-picture" accept="image/*;" style="position: absolute; width: 50px; height: 50px; left: 10px; top:10px; opacity: 0;  z-index: 1;" />
				<div style="width: 100%; height: 70px; clear: both;">
					<!-- <div class="userImage" id="headImage" style="background: url(/Public/images/act_per.png);float: left;  background-size: 100% 100%;"></div> -->
					<div class="userImage" id="headImage" style="background: url({$headimg});float: left;  background-size: 100% 100%;" onclick="modifyAvatar()"></div>
					<a class="appName">{$_SESSION['msg']['tel']}</a>
				
					<a class="logout" href="/index.php/Home/member/logout" style="color:#fff">退出当前账号</a>
				</div>
				<div class="money">
					<span class="num" style="margin-top:0.7rem">{$commissions|default="0.00"}</span>
					<span class="jieshao" style="margin-top:0.5rem">奖金总额:（元）</span>
					<p style="text-indent: 0;">
						<!-- <a href="#middlePopover" class="mui-btn mui-btn-primary" style="padding: 5px 20px; margin-right: 20px;">我要提现</a> -->
						<a href="#middlePopover" onclick="return tan()" class="mui-btn mui-btn-primary" style="padding: 5px 20px; margin-right: 20px; box-shadow: 4px 3px 8px #c0c0c3;" >我要提现</a> 
						<a href="/index.php/home/member/record" id="record" class="mui-btn mui-btn-success" style="padding: 5px 20px; margin-left: 20px;box-shadow: 2px 2px 6px #c0c0c3;">提现记录</a>
					</p>
			    </div>
			</div>
			<ul class="mui-table-view" style="margin-top: 15px;">
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<if condition="isset($_SESSION['msg']['tel'])">
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/wei/member/id/{$_SESSION['msg']['id']}">
				    <else/>
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/index/register">
					</if>
					<img src="/Public/images/1.png" class="icon" id="icon"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">我的团队</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<if condition="isset($_SESSION['msg']['tel'])">
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/wei/commission/id/{$_SESSION['msg']['id']}">
				    <else/>
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/index/register">
					</if>
					<img src="/Public/images/4.png" class="icon" id="icon"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">我的工资奖金</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<if condition="isset($_SESSION['msg']['tel'])">
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/recharge/commission/id/{$_SESSION['msg']['id']}">
							<else/>
							<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/index/register">
					</if>
					<img src="/Public/images/recharge.png" class="icon" id="icon"  style="vertical-align: middle; float: left;display: block;">
					<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">我的充值奖金</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<if condition="isset($_SESSION['msg']['tel'])">
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/wei/qrcode/id/{$_SESSION['msg']['id']}">
				    <else/>
						<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/index/register">
					</if>
					<img src="/Public/images/2.png" class="icon" id="icon"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">我的二维码</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/Sort/index">
						<img src="/Public/images/sort.png" class="icon" id="sort"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">排行榜</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/Shop/orderList">
						<img src="/Public/images/order-list.png" class="icon" id="order-list"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">我的订单</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;">
					<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/Chat/getHistory">
						<img src="/Public/images/history-hongbao-icon.png" class="icon" id="history"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">我的红包</span>
					</a>
				</li>
				<li class="mui-table-view-cell" style="margin: 0; padding: 0;" onclick="recharge()">
					<!--<a class="mui-navigate-right" style="margin: 0; padding: 0;" href="/index.php/Home/wei/recharge/id/{$_SESSION['msg']['id']}">-->
					<a class="mui-navigate-right" style="margin: 0; padding: 0;">
						<img src="/Public/images/chong.png" class="icon" id="recharge"  style="vertical-align: middle; float: left;display: block;">
						<span style="display: block;float: left;height: 100%; line-height: 55px; text-indent: 1em;font-size: 15px;">充值入口</span>
					</a>
				</li>
			</ul>
		</div>
		<div style="height:5.5rem;"></div>
		<nav class="mui-bar mui-bar-tab">
			<a id="shou" class="mui-tab-item " href="/index.php/home/index/index">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" href='/index.php/home/Chat/index'>
				<span class="mui-icon mui-icon-chat"></span>
				<span class="mui-tab-label">群聊</span>
			</a>
			<a id="shop" class="mui-tab-item" href="/index.php/Home/Shop/index">
				<span class="mui-icon"><i class="fa fa-shopping-cart" aria-hidden="true"></i></span>
				<span class="mui-tab-label">商城</span>
			</a>
			<a id="me" class="mui-tab-item" href="/index.php/home/member/index">
				<span class="mui-icon mui-icon-contact"></span>
				<span class="mui-tab-label">我的</span>
			</a>	
		</nav>
		
	</body>
	<script src="/Public/js/mui.min.js"></script>
	<script src="/Public/js/jquery.min.js"></script>
	<!-- <script src="/Public/localRZ/lrz.bundle.js"></script> -->
	<script>
		var isAndriod = navigator.userAgent.toLowerCase().match(/android/i) == "android";
		$(function(){
			if (isAndriod)
			{
				$('#take-picture').hide();
			}
		})
		$("#take-picture").on("change", function(e) {
			//alert(123);
	        var file = e.target.files[0]; // 获取图片资源
	        var fd = new FormData();
	        //var id = {$_SESSION['msg']['id']} ; // 用formdata上传文件
	        //alert(id);
	        // 只选择图片文件
	        if (!file.type.match('image.*')) {
	            return false;
	        }
	        fd.append('file', file, file.name); // 填入文件
	        $.ajax({
	            url: '/index.php/home/member/upload',
	            data:fd, 
	            processData: false,
	            contentType: false,
	            type: 'POST',
	            success: function (data) {
	                //console.log(data);
	                data=data.slice(1);
	                //console.log(data);
	                $('#headImage').css("background","url("+data+")");
	            }
	        });
	    });

        $('back').click(function(){
        	history.go(-1);
        })

	    function tan (){
	    	layer.open({
		        type: 1,
		        title:"提现",
		        closeBtn: false,
		        shift: 7,
		        shadeClose: true,
		       content: "<div style='width:350px;  text-align:center; margin-bottom:1.5rem;'><div style='width:320px;margin-left: 3%;' class='form-group has-feedback'><p>请输入提现金额</p><input id='money' class='form-control' type='text' name='money' value=''/></div>"+"<button style='margin-top:2%; background:#C0FCF0; width:30%;box-shadow: 4px 4px 10px #666;' type='button' class='btn btn-block btn-success btn-lg' onclick='queren()'>提交</button><button style='box-shadow: 4px 4px 10px #666;margin-top:2%; background:#FEB5B5; width:30%; margin-left: 10%' type='button' class='btn btn-block btn-success btn-lg' onclick='reset()'>取消</button></div>"
		    });

	    }

        function recharge(){
            var id = {$_SESSION['msg']['id']};
			
            $.ajax({
                type: "POST",
                url: "/index.php/Home/wei/check_auth",
                data: {"id":id},
                dataType: "json",
                success: function(data){
				    //console.log(data)
                    if(data.status==1){
                        var recharge_no = "/index.php/Home/wei/recharge/id/{$_SESSION['msg']['id']}/recharge_no/"+data.recharge_no;
                        window.location.href=recharge_no;
                    }else{
                        mui.toast('您没有充值权限！')
                    }
                }
            });
        }

	/*mui('body').on('tap','a',function(){
			    window.top.location.href=this.href;
			});*/

	    /*function tijiao(){
	    	//var id={$_SESSION['msg']['id']};
	    	var money=document.getElementById('money').value;
	    	var commission={$commissions};
	 		if(money>commission){
	 			mui.alert('您的余额不足！'); 
	 			mui('#middlePopover').popover('hide');
	 		}else{
	 			$.ajax({
                  type:"post",
                  url:"/index.php/Home/member/withdraw",
                  data:$('.mui-input-group').serialize(),
                  datatype:"json",
                  success:function(msg){
                  	mui('#middlePopover').popover('hide');
                    mui.alert(msg);  
                  }
            	});
	 		}
	    	
	    }*/
	    $(document).ready(function(){
		  $("#shou").click(function(){
		    $("#shou").addClass('class','mui-active');
		  });
		});

	    function queren(){

		    var money=document.getElementById('money').value;
		    //alert(money);
		    var commission={$commissions};
		    if(money==' ' || money==0){
		        layer.msg('提现金额不能为空或者是0',{
		        	time:1000,
		        });
		        //layer.closeAll();
		    }else if(money>commission){
		    	layer.msg('您的余额不足!',{
		    		time:1000,
		    	}); 
		        //layer.closeAll();
		    }else{
		       $.ajax({
                  type:"post",
                  url:"/index.php/Home/member/withdraw",
                  data:{
                  	"money":money
                  },
                  datatype:"json",
                  success:function(msg){
                  	//mui('#middlePopover').popover('hide');
                    layer.msg(msg);  
                  }
            	});
		        layer.closeAll();
		    }
		}

	    function reset(){
	    	$('#money').val('');
	    }
		
		function modifyAvatar()
		{			
			if (isAndriod)
			{
				window.upload.upload();
			}
		}

	    function uploadImage(avatar)
		{
            $.ajax({
                url: '/index.php/home/member/modifyAvatar',
                data:{'avatar': avatar},
                type: 'POST',
                success: function (data) {
                    location.reload();
                }
            });
        }
    </script>
</html>